﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Net;
using System.Xml;

namespace Wowhead.Common
{
    public static class Utils
    {

        public static XElement GetWowheadXmlObject(WowheadObjectType type, int ID)
        {
            XElement doc = null;

            using (WebClient wc = new WebClient())
            {
                wc.QueryString.Add("item", ID.ToString());
                wc.QueryString.Add("xml", "");

                using (XmlTextReader textReader = new XmlTextReader(wc.OpenRead("http://www.wowhead.com")))
                {
                    doc = XElement.Load(textReader);
                }
            }
            return doc;
        }
    }
}
